It is known that, in a case in which an imaging object having a size of several millimeters is observed by using a microscope having a focal depth of several tens of micrometers, or in a case in which an imaging object having a depth in the optical-axis direction is observed, an omnifocal image, which is focused in substantially the entire region thereof, is generated by using a plurality of images (hereinafter referred to as the Z-stack image) captured while shifting the focal position in the optical-axis direction, and by combining pixels of images having maximum focusing degrees at individual pixel positions (for example, see Patent Literature 1).
In Patent Literature 1, in a case in which the focusing degree at each position has two or more peak values, these peak values are detected as a plurality of candidate values, and a plurality of omnifocal images are generated by utilizing a specific number of Z-stack images for each of the detected candidate values.